@echo off
chcp 65001 > nul
title Test All Services

echo ====================================
echo   Test All UC System Services
echo ====================================
echo.

echo [1] Check Backend Service (Port 4000)...
curl -X GET http://localhost:4000/api/health 2>nul
if %errorlevel% equ 0 (
    echo ✅ Backend Service: WORKING
) else (
    echo ❌ Backend Service: FAILED
)

echo.
echo [2] Check Frontend Service (Port 8102)...
curl -X GET http://localhost:8102 2>nul
if %errorlevel% equ 0 (
    echo ✅ Frontend Service: WORKING
) else (
    echo ❌ Frontend Service: FAILED
)

echo.
echo [3] Check API Proxy (8102 -> 4000)...
curl -X POST http://localhost:8102/api/auth/login -H "Content-Type: application/json" -d "{\"username\":\"admin\",\"password\":\"Admin123\"}" 2>nul
if %errorlevel% equ 0 (
    echo ✅ API Proxy: WORKING
) else (
    echo ❌ API Proxy: FAILED
)

echo.
echo [4] Check AI Service (Port 5001)...
curl -X GET http://localhost:5001/health 2>nul
if %errorlevel% equ 0 (
    echo ✅ AI Service: WORKING
) else (
    echo ❌ AI Service: FAILED
)

echo.
echo ====================================
echo     Service Status Summary
echo ====================================
echo.
echo If any service shows FAILED:
echo 1. Make sure all three CMD windows are open
echo 2. Check for error messages in each window
echo 3. Try running start_all_english.bat again
echo.
echo Access URLs:
echo - Frontend: http://localhost:8102
echo - Backend: http://localhost:4000/api/health
echo - AI Service: http://localhost:5001/health
echo.
pause
